<template>
	<om-formsub-outer :index="index">
		<om-autoform ref="autoform" :initConfigData="autoformdata" :initValue="initValue"></om-autoform>
	</om-formsub-outer>
</template>

<script>
	import {buildSubFormData, subOnLoad, changeEditor,configSelectData} from '../../../static/js/formUtil.js';
	import { ignoreHtml,ptFloat,minusF,getDateStr} from '@/static/js/common.js';
	import urlUtil from '@/static/js/urlUtil.js';
	export default {
		provide() {
			return {
				formPage: this
			};
		},
		data() {
			return buildSubFormData({
				initValue:{
				},
				autoformdata: [],
				cachename:'',
				index:null,
				datas:[],
				order:0,
				formdata:{},
				appellationCacheKey:"hr-u-adjustinfo-data-info-familyMember-appellation-cache"
			})
		},
		methods: {
			initLoad(){
				let _that = this
				changeEditor("familyMember", "appellationFCode", {
					link: '../../public/search/search',
					"linkParam":{
						other: JSON.stringify({
							code:'23597'
						}),
						namefield:"dicname",
						initload:true,
						url:urlUtil.dictZeroComboboxUrl().url,
						cachename:_that.appellationCacheKey
					}
				},_that.autoformdata)
			}
		},
		onLoad(e){
			let _that = this
			subOnLoad(_that, e, function() {
				if(e.configDataCacheKey){
					uni.getStorage({
						key: e.configDataCacheKey,
						success: function(res) {
							//if(res.data && res.data instanceof Array){
							if(res.data && Object.prototype.toString.call(res.data)==='[object Array]'){
								_that.autoformdata = res.data
								Object.assign(_that.initValue, _that.formdata)
								_that.autoformdata[0].order = _that.order
								_that.initLoad()
							}
						}
					});
				}
			})
		},
		onShow() {
			let _that = this
			if(_that.$refs.autoform){
				uni.getStorage({
					key: this.appellationCacheKey,
					success: function(res) {
						if(res.data){
							let d = res.data
							var formdata  = _that.$refs.autoform.formdata
							formdata.appellationFCode = d.code
							formdata.appellationFName = d.dicname
							uni.removeStorage({
								key: _that.appellationCacheKey
							});
						}
					}
				});
			}
		}
	}
</script>

<style>

</style>
